//
//  DCDriverManagerBaseCell.m
//  JiuyaoMotorcade
//
//  Created by 大橙子 on 2018/12/3.
//  Copyright © 2018 Tomous. All rights reserved.
//

#import "DCDriverManagerBaseCell.h"
static const int kBaseCellHeight = 30;
@implementation DCDriverManagerBaseCell
-(void)setUpBaseUIView
{
    self.firstView = [[UIView alloc]init];
    self.firstView.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.firstView];
    
    self.nameLabel = [[UILabel alloc]init];
//    self.nameLabel.text = @"京A88888";
    //    self.plateNumLabel.backgroundColor = [UIColor redColor];
    [self.firstView addSubview:self.nameLabel];
    self.stateLabel = [[UILabel alloc]init];
    self.stateLabel.textColor = [UIColor redColor];
//    self.stateLabel.text = @"满载";
    self.stateLabel.textAlignment = NSTextAlignmentRight;
    //    self.stateLabel.backgroundColor = [UIColor yellowColor];
    [self.firstView addSubview:self.stateLabel];
    
    self.secondView = [[UIView alloc]init];
    self.secondView.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.secondView];
    
    self.carImageView = [[UIImageView alloc]init];
    self.carImageView.image = IMAGENAME(@"1234567");
    [self.secondView addSubview:self.carImageView];
    
    self.plateLabel = [[DCImageAndTextLabel alloc]init];
    self.plateLabel.imageView.image = IMAGENAME(@"货车");
    self.plateLabel.textLabel.textColor = [UIColor lightGrayColor];
    [self.secondView addSubview:self.plateLabel];
    
    self.phoneLabel = [[DCImageAndTextLabel alloc]init];
    self.phoneLabel.imageView.image = IMAGENAME(@"phone line circle");
    self.phoneLabel.textLabel.textColor = [UIColor lightGrayColor];
    [self.secondView addSubview:self.phoneLabel];
    
    self.locationLabel = [[DCImageAndTextLabel alloc]init];
    self.locationLabel.imageView.image = IMAGENAME(@"Icon Location");
    self.locationLabel.textLabel.textColor = [UIColor lightGrayColor];
    [self.secondView addSubview:self.locationLabel];
    
    self.thirdView = [[UIView alloc]init];
    self.thirdView.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.thirdView];
    
    self.firstBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    //    self.firstBtn.backgroundColor = BlueColor;
//    [self.firstBtn setTitle:@"保养维护" forState:UIControlStateNormal];
    self.firstBtn.titleLabel.font = FONT(14);
    self.firstBtn.layer.cornerRadius = 14;
    self.firstBtn.clipsToBounds = YES;
    self.firstBtn.layer.borderColor = BlueColor.CGColor;
    self.firstBtn.layer.borderWidth = 1;
    [self.firstBtn setTitleColor:BlueColor forState:UIControlStateNormal];
    self.firstBtn.tag =0;
    [self.thirdView addSubview:self.firstBtn];
    
    self.secondBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    //    self.secondBtn.backgroundColor = BlueColor;
//    [self.secondBtn setTitle:@"驾驶数据" forState:UIControlStateNormal];
    self.secondBtn.titleLabel.font = FONT(14);
    self.secondBtn.layer.cornerRadius = 14;
    self.secondBtn.clipsToBounds = YES;
    self.secondBtn.layer.borderColor = BlueColor.CGColor;
    self.secondBtn.layer.borderWidth = 1;
    [self.secondBtn setTitleColor:BlueColor forState:UIControlStateNormal];
    self.secondBtn.tag =1;
    [self.thirdView addSubview:self.secondBtn];
    
    self.thirdBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    //    self.secondBtn.backgroundColor = BlueColor;
//    [self.thirdBtn setTitle:@"驾驶数据" forState:UIControlStateNormal];
    self.thirdBtn.titleLabel.font = FONT(14);
    self.thirdBtn.layer.cornerRadius = 14;
    self.thirdBtn.clipsToBounds = YES;
    self.thirdBtn.layer.borderColor = BlueColor.CGColor;
    self.thirdBtn.layer.borderWidth = 1;
    [self.thirdBtn setTitleColor:BlueColor forState:UIControlStateNormal];
    self.thirdBtn.tag =2;
    [self.thirdView addSubview:self.thirdBtn];
}
-(void)setUpLayoutSubViews
{
    self.firstView.frame = CGRectMake(0, 5, self.width, kBaseSubViewHeight);
    self.nameLabel.frame = CGRectMake(10, 0, self.firstView.width/2, kBaseSubViewHeight);
    __weak typeof(self) weakself = self;
    [self.stateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakself.firstView);
        make.right.equalTo(weakself.firstView.mas_right).offset(-10);
        make.height.mas_offset(kBaseSubViewHeight);
        make.width.mas_offset(weakself.firstView.width/2);
    }];
    
    self.secondView.frame = CGRectMake(0, self.firstView.bottom+1, self.width, kBaseCellHeight*4);
    self.carImageView.size = CGSizeMake(kBaseCellHeight*3-25, kBaseCellHeight*3-25);
    self.carImageView.y = (self.secondView.height - self.carImageView.height)/2;
    self.carImageView.x = 10;
    self.plateLabel.frame = CGRectMake(self.carImageView.right+10, 0, self.width - 30-self.carImageView.width, kBaseCellHeight);
    self.phoneLabel.frame = CGRectMake(self.plateLabel.x, self.plateLabel.bottom, self.plateLabel.width, kBaseCellHeight);
    self.locationLabel.frame = CGRectMake(self.plateLabel.x, self.phoneLabel.bottom, self.plateLabel.width, kBaseCellHeight);
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
